<?php
/**
* @version		$Id: text.php 6138 2007-01-02 03:44:18Z eddiea $
* @package		Joomla
* @subpackage	Galleries
* @copyright	Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

/**
 * Renders a author element
 *
 * @author 		Louis Landry
 * @package 	Joomla
 * @subpackage	Articles
 * @since		1.5
 */
class JElementGalleries extends JElement
{
   /**
	* Element name
	* @access	protected
	* @var		string
	*/
	var	$_name = 'Galleries';

	function fetchElement($name, $value, &$node, $control_name)
	{
		$db =& JFactory::getDBO();
		$query = 'SELECT id AS value, name AS text FROM #__rsgallery2_galleries where parent = 0';
		$db->setQuery( $query );
		$parent_galleries = $db->loadObjectList();
		$element[] = JHTML::_( 'select.option', $parent_galleries);
		foreach($parent_galleries as $k=>$v){
			//$element[] = JHTML::_( 'select.option', $v);
			$query = 'SELECT id AS value, name AS text FROM #__rsgallery2_galleries where parent = '.$db->Quote($k);
			$db->setQuery( $query );
			//$k->child_galleries = $db->loadObjectList();
			//$element[] = JHTML::_( 'select.optgroup', $db->loadObjectList() );
			
		}//end foreach
	//	var_dump($element);
	//	echo JHTML::_( 'select.genericlist', $element, 'Test' );
	/*	
		<SELECT name="ComOS">
     <OPTION selected label="none" value="none">None</OPTION>
     <OPTGROUP label="PortMaster 3">
       <OPTION label="3.7.1" value="pm3_3.7.1">PortMaster 3 with ComOS 3.7.1</OPTION>
       <OPTION label="3.7" value="pm3_3.7">PortMaster 3 with ComOS 3.7</OPTION>
       <OPTION label="3.5" value="pm3_3.5">PortMaster 3 with ComOS 3.5</OPTION>
     </OPTGROUP>
     <OPTGROUP label="PortMaster 2">
       <OPTION label="3.7" value="pm2_3.7">PortMaster 2 with ComOS 3.7</OPTION>
       <OPTION label="3.5" value="pm2_3.5">PortMaster 2 with ComOS 3.5</OPTION>
     </OPTGROUP>
     <OPTGROUP label="IRX">
       <OPTION label="3.7R" value="IRX_3.7R">IRX with ComOS 3.7R</OPTION>
       <OPTION label="3.5R" value="IRX_3.5R">IRX with ComOS 3.5R</OPTION>
     </OPTGROUP>
 </SELECT>
 	*/
		//echo JHTML::_( 'select.options', $weblinks );
	}
}
?>
